package cn.mazexal.examapi.models.enums;

import lombok.Getter;

/**
 * @author: Mazexal
 * Date: 2025/6/18
 */
@Getter
public enum PlatformEnum {

    ANDROID(1, "Android"),
    IOS(2, "iOS"),
    WEB(3, "Web"),
    WechatMiniApp(4, "WechatMiniApp"),
    iPadOS(5, "iPadOS"),
    AndroidPad(6, "AndroidPad"),
    HongMeng(7, "HongMeng");

    private String value;

    private Integer code;

    PlatformEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public static PlatformEnum getByCode(Integer code) {
        for (PlatformEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static PlatformEnum getByValue(String value) {
        for (PlatformEnum value1 : values()) {
            if (value1.value.equals(value)) {
                return value1;
            }
        }
        return null;
    }
}
